	(ns cl-slika.views.sadrzaj
	  (:require [cl-slika.views.common :as common]
	            [noir.session :as session]
	            [noir.response :as resp]
	            [clojure.java.io :as io]
	            [cl-slika.models.user :as users]
	            )
	  (:use [noir.core :only [defpage]])
	  )
	
 (defn div-login [] 
   
      [:div#login.showMenu {:style "visibility:hidden" :tabindex 0 :onblur "sakrij(this);"} 
			             [:form {:action "/user/provera" :method "post" :enctype "multipart/form-data"}
			             [:label "user"] [:input {:type "text" :name "username"} ] [:br]
			             [:label "pass"] [:input {:type "password" :name "password" } ] [:br]
			             [:input {:type "submit" :value "Login"}] 
		              ]
		             ]
   )
 
 (defn div-register []
   [:div#register.showMenu {:style "visibility:hidden" :tabindex 0 :onblur "sakrij(this);"}
	            [:form {:action "/user/add" :method "post" :enctype "multipart/form-data"}
	             [:label "mail"]  [:input {:type "email" :name "mail"} ] [:br]
	             [:label "user"]  [:input {:type "text" :name "username"} ] [:br]
	             [:label "pass"] [:input {:type "password" :name "passwordR"} ] [:br]
	             [:label "pass"] [:input {:type "password" :name "password2R" :onblur "istaSifra()"} ] [:br]
	             [:input {:type "submit" :name "btnR" :value "Register" :disabled "disabled"}]
	              ]
	             ]
   )
 
 (defn s-out[]
  [:div
       [:button {:onclick "login('login')" :id "btnLogin" } "Login"]
        [:button {:onclick "login('register')" :id "btnRegister" } "Register"]
        ]
       )
     
 (defn s-in []
     
       [:a {:href "/logout" :id "btnLogout"} (str "logout " (users/me))]
       )
 
     
 (defn session-btns[]          
       (if-not (= nil (users/me)) (s-in) (s-out))
  )
        
   (defn forma[]
    [:form {:action "/upload1" :method "post" :enctype "multipart/form-data"}
		            [:input.zaobljeno {:name "myFile" :type "file" :id "myFile"}][:br]
		           
		            [:label {:id "lblFilter"} "Izaberite filter"]
		            [:select.zaobljeno {:name "filter"}
	               [:option {:value "0"} "HSB Filter"]
	               [:option {:value "1"} "Diffusion Filter"]
	               [:option {:value "2"} "Quantize Filter"]
	               [:option {:value "3"} "Solarize Filter"]
	               [:option {:value "4"} "Kaleidoscope Filter"]
	               [:option {:value "5"} "Marble Filter"]
	               [:option {:value "6"} "BlurFilter"]
		             [:option {:value "7"} "Crystallize Filter"]
		             [:option {:value "8"} "Chrome Filter"]
	               [:option {:value "9"} "RedFilter"]
	               [:option {:value "10"} "GreenFilter"]
	               [:option {:value "11"} "Blue Filter"]
	               [:option {:value "12"} "Gray Filter"]
	               [:option {:value "13"} "Grayscale Filter"]
	              ]
	             [:br]
		            
		            [:input.zaobljeno {:id "dugme" :type "submit"}]
	            ]
   )
 


   (defn down [& putanja]
   
		   [:div#downlink.skriveni
      (str "<script>ubaciSliku('" "/link?putanja="  (first  putanja) "' );</script>") ;
		    [:a {:href (str "/link?putanja=" (first  putanja) )} "download"]
		       ]
     ;
   )
  
   (defn autenticate [poruka & username]
 
  (if-not (instance? String poruka)
             (resp/redirect (str "/?poruka=" "ulogovani ste"))
           (resp/redirect (str "/?poruka=" poruka))
           
           )
  )
